Imports System.Windows.Forms

Public Class MDIParent

    Private Sub AbrirFormPacientes(ByVal sender As Object, ByVal e As EventArgs) Handles PacientesTSB.Click
        For Each ChildForm As Form In Me.MdiChildren
            ChildForm.Hide()
        Next
        ChildPacientes.Show()
        ChildPacientes.Left = 0
        ChildPacientes.Top = 0
    End Sub

    Friend Sub AbrirFormAgenda(ByVal sender As Object, ByVal e As EventArgs) Handles AgendaTSB.Click
        For Each ChildForm As Form In Me.MdiChildren
            ChildForm.Hide()
        Next
        ChildAgenda.Show()
        ChildAgenda.Left = 0
        ChildAgenda.Top = 0
        If sender.ToString = "Agenda" Then Exit Sub
        'FormCita.Activate()
        With FormCita
            .cbCitaDia.SelectedIndex = 3
            .tbCitaHora.Text = "8:00"
            .tbCitaDurac.Text = "45"
            .bCitaOK.Enabled = True
            .Text = "Agregar Cita"
            .bCitaOK.Text = "Aceptar"

            Dim oRes As DialogResult = .ShowDialog()
            If oRes = Windows.Forms.DialogResult.OK Then

                FormAgenda.pActualizaCita()
                FormAgenda.GetConsult()
                'FormAgenda.Refresh()
            End If
end with
    End Sub

    Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim SaveFileDialog As New SaveFileDialog
        SaveFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        SaveFileDialog.Filter = "Archivos de texto (*.txt)|*.txt|Todos los archivos (*.*)|*.*"

        If (SaveFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
            Dim FileName As String = SaveFileDialog.FileName
            ' TODO: agregar código aquí para guardar el contenido actual del formulario en un archivo.
        End If
    End Sub


    Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Global.System.Windows.Forms.Application.Exit()
    End Sub

    Private Sub CutToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Utilice My.Computer.Clipboard para insertar el texto o las imágenes seleccionadas en el Portapapeles
    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Utilice My.Computer.Clipboard para insertar el texto o las imágenes seleccionadas en el Portapapeles
    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        'Utilice My.Computer.Clipboard.GetText() o My.Computer.Clipboard.GetData para recuperar la información del Portapapeles.
    End Sub


    Private Sub CascadeToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.Cascade)
    End Sub

    Private Sub TileVerticleToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.TileVertical)
    End Sub

    Private Sub TileHorizontalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.TileHorizontal)
    End Sub

    Private Sub ArrangeIconsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.ArrangeIcons)
    End Sub

    Public ChildFicha As New FormFicha

    Public ChildAgenda As New FormAgenda

    Public ChildPacientes As New FormPacientes
    
    'Public FCita As New FormCita

    Private Sub CloseAllToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Cierre todos los formularios secundarios del primario.
        For Each ChildForm As Form In Me.MdiChildren
            ChildForm.Close()
        Next
    End Sub

    Private m_ChildFormNumber As Integer = 0

    Private Sub MDIParent_ClientSizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ClientSizeChanged
        For Each ChildForm As Form In Me.MdiChildren
            ChildForm.Width = Me.Width - 15
            ChildForm.Height = Me.Height - 85
        Next
    End Sub

    Private Sub MDIParent_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ' Cree  nuevas instancias del formulario secundario.
        ' Conviértalos en elementos secundarios de este formulario MDI antes de mostrarlo.
        ChildPacientes.MdiParent = Me
        ChildAgenda.MdiParent = Me
        ChildFicha.MdiParent = Me
    End Sub

    Private Sub FichasTSB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FichasTSB.Click
        'For Each ChildForm As Form In Me.MdiChildren
        '    ChildForm.Hide()
        'Next
        'ChildFicha.Show()
        'ChildFicha.Left = 0
        'ChildFicha.Top = 0
        WeiDaoApp.MostrarFicha(UtilsDB.GetPaciente(1))
    End Sub

#Region "Privates"

    'Dim m_iie As Label

#End Region

#Region "Clicks del toolbar"

    Private Sub btnDebug_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDebug.Click
        Dim frmOpc As FormOpciones

        frmOpc = New FormOpciones
        frmOpc.MdiParent = Me

        frmOpc.Show()

    End Sub

#End Region

#Region "Rutinas vemos despues"


#End Region

End Class
